package ex;

import java.util.Scanner;

public class H11 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in );
        System.out.println("输入12位商品码：");
        String inputValue=sc.next();
        int oddsum = 0;
        int evensum =0;
        int a = 0;
        int b = 0;
        int c = 0;
        int d = 0;
        for (int i = 0; i <inputValue.length(); i+=2) {
            int odd = inputValue.charAt(i) -'0';
            oddsum+=odd;
        }
        for (int i1 =1;i1 <inputValue.length();i1+=2){
             int even = inputValue.charAt(i1) -'0';
             evensum+=even;
        }
        a = oddsum + 3 * evensum;
        b = a % 10;
        c =  10 - b;
        d = c % 10;
        System.out.println(d);
        System.out.println("输出的数字为： "+ inputValue+ d);
    }
}
